package com.sojpt.boot;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.jfinal.core.JFinalFilter;

@Configuration
public class SoJptBoot {

	@Autowired
	private SoJptConfig soJptBootConfig;

	@Bean
	public FilterRegistrationBean<JFinalFilter> jFinalFilterRegistration() {

		FilterRegistrationBean<JFinalFilter> registration = new FilterRegistrationBean<JFinalFilter>();
		registration.setFilter(new JFinalFilter(soJptBootConfig));
		registration.addUrlPatterns("/*");
		registration.setName("jfinal");
		registration.setOrder(10);
		return registration;
	}

}
